<template>
    <div>  
        <h2>店铺列表</h2>  
        <ul>  
          <li v-for="shop in shops" :key="shop.id">  
          <router-link :to="`/shop/${shop.id}`">{{ shop.shopName }}  </router-link>
          </li>  
        </ul>  
        <h2>店铺核销</h2>
        <router-link to="/prizecheck">去核销  </router-link>
      </div>

  </template>
  
  <script>
  import { request } from '../utils/request.js';
  export default {
    // eslint-disable-next-line vue/multi-word-component-names
    name:"Index",
    data() {
      return {
        shops: '',
      };
    },
    mounted() {
      this.fetchData();
    },
    methods: {
      async fetchData() {
        try {
          const data = await request.get('/shops');
          this.shops = data.data
        } catch (error) {
          console.error(error);
        }
      },
    },
  };
  </script>